﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HolaMundo
{
    class RandomGreeter
    {
        private static List<String> greetingsList;

        public static String getRandomGreeting()
        {
            if (greetingsList == null)
                initializeList();

           // return greetingsList.Count.ToString();
            Random rnd = new Random((int)DateTime.Now.Ticks);
            int randomIndex = rnd.Next(0, greetingsList.Count);

            return greetingsList[randomIndex];
        }

        private static void initializeList()
        {
            String[] arr = { "Hola, hulero", "Chupala!", "Kiubole, kiubole", "Ay, mi gorda!" };
            greetingsList = new List<String>();

            foreach(String greet in arr){
                greetingsList.Add(greet);
            }
        }
    }
}
